//
//  XMSegmentView.h
//  XMKit
//
//  Created by Ce Liu on 2018/5/29.
//  Copyright © 2018年 ChenXiaoMing. All rights reserved.
//

#import <UIKit/UIKit.h>

@class XMSegmentView;

@protocol XMSegmentViewDelegate <NSObject>

- (void)segmentView:(XMSegmentView *)view didSelectedIndex:(NSInteger)index;

@end

typedef void(^segmentBlock)(NSInteger index);

@interface XMSegmentView : UIView

@property (nonatomic, weak) id <XMSegmentViewDelegate> delegate;

@property (nonatomic, strong) NSArray<NSString *> *datas;

@property (nonatomic, assign) NSInteger selectedIndex;

@property (nonatomic, strong) UIColor *normalColor;

@property (nonatomic, strong) UIColor *selectedColor;

@property (nonatomic, assign) CGFloat fontSize;

- (void)setSelectedIndex:(NSInteger)selectedIndex animation:(BOOL)animation;

- (void)reloadData ;

- (void)selectedIndexWithBlock:(segmentBlock)block ;

+ (instancetype)segmentTitleViewWithDatas:(NSArray<NSString *> *)datas;

@end

@interface XMSegmentCell : UICollectionViewCell

@property (nonatomic, copy) NSString *title;

@property (nonatomic, assign) BOOL isSelected;

@property (nonatomic, strong) UIColor *selectedColor;

@property (nonatomic, strong) UIColor *normalColor;

@property (nonatomic, assign) CGFloat fontSize;

@end


@interface XMSegmentModel : NSObject

@property (nonatomic, copy) NSString *title;

@property (nonatomic, assign) CGFloat width;

@property (nonatomic, assign) BOOL selected;

@property (nonatomic, assign) CGFloat fontSize;

@end
